package com.heima.三种注入方式;

import com.heima.LockApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * @author 陈辉
 * @data 2023 11:48
 */
@Component
//@Scope("prototype")
@Scope("singleton")
public class StringRedisTemplate01 implements StringRedisTemplate{
}

class Demo1{
    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(LockApplication.class);
        Object template01 = context.getBean("stringRedisTemplate01");
        System.out.println("template01 = " + template01);

        Object template02 = context.getBean("stringRedisTemplate01");
        System.out.println("template02 = " + template02);
    }
}
